<template>
    <div class="app-container">
        <!-- <el-row :gutter="10" class="mb8">
            <el-col :span="1.5">
                <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
                    v-hasPermi="['business:guest:export']">导出</el-button>
            </el-col>
            <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
        </el-row> -->

        <el-table v-loading="loading" :data="guestList" border>
            <!-- <el-table-column type="selection" width="55" align="center" /> -->
            <!-- <el-table-column label="" align="center" prop="id" v-if="true" />
            <el-table-column label="" align="center" prop="dormitoryid" v-if="true" /> -->
            <el-table-column label="申请人" align="center" prop="applicant" />
            <el-table-column label="房客信息" align="center" prop="tenant" />
            <el-table-column label="入住时间" align="center" prop="checkin" width="180"/>
            <!-- <el-table-column label="入住时间" align="center" prop="checkin" width="180">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.checkin, '{y}-{m}-{d} {h}:{h}:{h}') }}</span>
                </template>
            </el-table-column> -->
            <el-table-column label="预计天数" align="center" prop="expectedusedays" />
            <!-- <el-table-column label="退房时间" align="center" prop="checkout" width="180">
                <template slot-scope="scope">
                    <span>{{ parseTime(scope.row.checkout, '{y}-{m}-{d} {h}') }}</span>
                </template>
            </el-table-column> -->
            <el-table-column label="退房时间" align="center" prop="checkout" width="180"/>
            <el-table-column label="引领人" align="center" prop="leader" />
            <el-table-column label="钥匙领取人" align="center" prop="keyrecipient" />
            <el-table-column label="联系方式" align="center" prop="keyrecipientTel" />
            <el-table-column label="入住人" align="center" prop="actualPerson" />
            <el-table-column label="联系方式" align="center" prop="actualPersonTel" />
            <el-table-column label="备注" align="center" prop="remark" />
            <!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
                <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
                        v-hasPermi="['business:guest:edit']">修改</el-button>
                    <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
                        v-hasPermi="['business:guest:remove']">删除</el-button>
                </template>
            </el-table-column> -->
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
            @pagination="getList" />
    </div>
</template>
  
<script>
import { listGuest, getGuest, delGuest, addGuest, updateGuest } from "@/api/business/guest";

export default {
    name: "Guestlist",
    data() {
        return {
            // 遮罩层
            loading: true,
            // 显示搜索条件
            showSearch: true,
            // 总条数
            total: 0,
            // 招待所使用记录表格数据
            guestList: [],

            // 查询参数
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                dormitoryid: undefined,
            },

        };
    },
    created() {
        //const dormitoryid = this.$route.params && this.$route.params.dormitoryid;
        const dormitoryid = this.$route.query && this.$route.query.dormitoryid;
        //console.log(dormitoryid)
        if (dormitoryid) {
            this.queryParams.dormitoryid = dormitoryid;
            this.getList();

        }
    },
    methods: {
        getList() {
            this.loading = true;
            listGuest(this.queryParams).then(response => {
                this.guestList = response.rows;
                this.total = response.total;
                this.loading = false;
            });
        },
        /** 导出按钮操作 */
        handleExport() {
            this.download('business/guest/export', {
                ...this.queryParams
            }, `guest_${new Date().getTime()}.xlsx`)
        }
    }
};
</script>
  